package com.bone.product.dao;

import java.util.HashMap;
import java.util.Map;

import com.bone.common.BaseIbatisDAO;
import com.bone.page.Page;
import com.bone.product.po.ProductProdImage;


/**
 * DAO.
 * @author liwenzhan
 *
 */
public class ProductProdImageDAO extends BaseIbatisDAO {

	
	/**
	 * 取符合查询条件的数据.
	 * @param parameter
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public Page<ProductProdImage> queryProductImagePageByParam(Map<String, Object> para,Page page){
		Long totalResultSize = (Long) getSqlMapClientTemplate().queryForObject("PRODUCTIMAGE.queryByParamCount", para);
		page.setTotalResultSize(totalResultSize);				
		para.put("startRows", page.getStartRows());				
		para.put("endRows", page.getEndRows());
		para.put("_order", "product_id");
		page.setItems(getSqlMapClientTemplate().queryForList("PRODUCTIMAGE.queryByParam", para));
		return page;
	}
	
	/**
	 * .
	 * @param objectId
	 * @return
	 */
	public ProductProdImage queryEmployeeByAccount(final Long productId,final String imageName){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("productId", productId);
		map.put("imageName", imageName);
		return  (ProductProdImage) super.getSqlMapClientTemplate().queryForObject("PRODUCTIMAGE.queryProductImageByAccount", map);
	}
	

}
